<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;

class UploadeController extends Controller
{
    public function upload_img_for_ckeditor4(Request $request)
    {
        $avatar = $request->file('upload')->store('/public/' . date('Y-m-d') . '/avatars');
        //上传的头像字段avatar是文件类型
        $url = Storage::url($avatar);//就是很简单的一个步骤
        return [
            "uploaded" => true,
            "fileName" => '',
            "url" => $url,
            "error" => [
                "message" => ''
            ]
        ];
    }
}
